home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / Tool Chest / Interfaces / MPW Interfaces / PInterfaces / Dictionary.p < prev    next >
Encoding:
Text File  |  1993-09-17  |  3.1 KB  |  119 lines  |  [TEXT/MPS ]

  1. {
  2.     File:        Dictionary.p
  3.  
  4.     Copyright:    © 1983-1993 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Version:    System 7.1 for ETO #11
  8.     Created:    Tuesday, March 30, 1993 18:00
  9.  
  10. }
  11.  
  12. {$IFC UNDEFINED UsingIncludes}
  13. {$SETC UsingIncludes := 0}
  14. {$ENDC}
  15.  
  16. {$IFC NOT UsingIncludes}
  17.  UNIT Dictionary;
  18.  INTERFACE
  19. {$ENDC}
  20.  
  21. {$IFC UNDEFINED UsingDictionary}
  22. {$SETC UsingDictionary := 1}
  23.  
  24. {$I+}
  25. {$SETC DictionaryIncludes := UsingIncludes}
  26. {$SETC UsingIncludes := 1}
  27. {$IFC UNDEFINED UsingTypes}
  28. {$I $$Shell(PInterfaces)Types.p}
  29. {$ENDC}
  30. {$IFC UNDEFINED UsingFiles}
  31. {$I $$Shell(PInterfaces)Files.p}
  32. {$ENDC}
  33. {$SETC UsingIncludes := DictionaryIncludes}
  34.  
  35. CONST
  36.  
  37. { Dictionary data insertion modes }    
  38. kInsert                 =     0;            {Only insert the input entry if there is nothing in the dictionary that matches the key.}
  39. kReplace                 =     1;            {Only replace the entries which match the key with the input entry.}
  40. kInsertOrReplace         =     2;            {Insert the entry if there is nothing in the dictionary which matches the key.}
  41.                                         {If there is already matched entries, replace the existing matched entries with the input entry.}
  42.  
  43. { Key attribute constants }
  44. kIsCaseSensitive            =    $10;    {case sensitive = 16}
  45. kIsNotDiacriticalSensitive    =    $20;    {diac not sensitive = 32}
  46.  
  47. { Registered attribute type constants }
  48. kNoun                    =    -1;
  49. kVerb                    =    -2;
  50. kAdjective                =    -3;
  51. kAdverb                    =    -4;
  52.  
  53. TYPE
  54.  
  55. { Dictionary information record }
  56. DictionaryInformation = RECORD
  57.     dictionaryFSSpec: FSSpec;
  58.      numberOfRecords: LONGINT;
  59.      currentGarbageSize: LONGINT;
  60.      script: ScriptCode;
  61.      maximumKeyLength: INTEGER;
  62.      keyAttributes: Byte;
  63.     END;
  64.     
  65. { Dictionary Manager routines }
  66. FUNCTION InitializeDictionary(     theFsspecPtr: FSSpecPtr;
  67.                                 maximumKeyLength: INTEGER;
  68.                                 keyAttributes: Byte;
  69.                                 script: ScriptCode): OSErr;
  70.  INLINE $303C,$0500,$AA53;
  71.  
  72. FUNCTION OpenDictionary(     theFsspecPtr: FSSpecPtr;
  73.                             accessPermission: SignedByte;
  74.                             VAR dictionaryReference: LONGINT): OSErr;
  75.  INLINE $303C,$0501,$AA53;
  76.  
  77. FUNCTION CloseDictionary( dictionaryReference: LONGINT): OSErr;
  78.  INLINE $303C,$0202,$AA53;
  79.  
  80. FUNCTION InsertRecordToDictionary(     dictionaryReference: LONGINT;
  81.                                     key: Str255;
  82.                                     recordDataHandle: Handle;
  83.                                     whichMode: INTEGER): OSErr;
  84.  INLINE $303C,$0703,$AA53;
  85.  
  86. FUNCTION DeleteRecordFromDictionary(     dictionaryReference: LONGINT;
  87.                                         key: Str255): OSErr;
  88.  INLINE $303C,$0404,$AA53;
  89.  
  90. FUNCTION FindRecordInDictionary(     dictionaryReference: LONGINT;
  91.                                     key: Str255;
  92.                                     requestedAttributeTablePointer: Ptr;
  93.                                     recordDataHandle: Handle): OSErr;
  94.  INLINE $303C,$0805,$AA53;
  95.  
  96. FUNCTION FindRecordByIndexInDictionary( dictionaryReference: LONGINT;
  97.                                         recordIndex: LONGINT;
  98.                                         requestedAttributeTablePointer: Ptr;
  99.                                         VAR recordKey: Str255;
  100.                                         recordDataHandle: Handle): OSErr;
  101.  INLINE $303C,$0A06,$AA53;
  102.  
  103. FUNCTION GetDictionaryInformation(     dictionaryReference: LONGINT;
  104.                                     VAR theDictionaryInformation: DictionaryInformation): OSErr;
  105.  INLINE $303C,$0407,$AA53;
  106.  
  107. FUNCTION CompactDictionary( dictionaryReference: LONGINT): OSErr;
  108.  INLINE $303C,$0208,$AA53;
  109.  
  110.  
  111.  
  112. {$ENDC} { UsingDictionary }
  113.  
  114. {$IFC NOT UsingIncludes}
  115.  END.
  116. {$ENDC}
  117.  
  118.  
  119.